package com.ojoin.trade.supplyloan_core.web.service;

import java.util.List;
import java.util.Map;

import org.springframework.data.domain.Pageable;

import com.ojoin.trade.common.web.service.BaseService;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlSupplyPayment;

public interface TbSlSupplyPaymentService extends BaseService<TbSlSupplyPayment> {

	/**
	 * 按平台用户删除历史数据
	 * id_merchant_user_platform_name
	 */
	int deleteByPlatformAccountId(Integer platformAccountId);
	
	int deleteByPlatformAccountId(Integer platformAccountId,String rowCreateTime);
	
	
	/**
	 * 按平台账号以及业务时间查询
	 * 
	 * 
	 */ 
	
	
	String getLastInsertTime(int platformAccountId);
	
	String getLastsettlementDate(int platformAccountId);
	
	
	String getLastcreateDate(int platformAccountId);
	
	String getLastcreateDate(int platformAccountId,String settlementState);
	
	Map<Integer,List<TbSlSupplyPayment>> queryByMerchantUser(int idOfTbMerchantUser,String DateStart, String DateDateEnd,String settlementState);

	List<TbSlSupplyPayment> queryByUidAndCreateDateAndRowCreate(int platformAccountId,String createDateStart,String createDateEnd,String rowCreateTimeStart,String rowCreateTimeEnd, String settlementState,Pageable page);

	
	List<TbSlSupplyPayment> queryByUidAndCreateDate(int platformAccountId,String createDateStart,String createDateEnd, String settlementState,Pageable page);

	List<TbSlSupplyPayment> queryByUidAndCreateDate(int platformAccountId,String createDateStart,String createDateEnd, String settlementState);

	List<TbSlSupplyPayment> queryByUidAndCreateDate(int platformAccountId,String createDateStart,String createDateEnd);
	
	
	/**
	 * 按平台账号以及入库时间
	 * 
	 * 
	 */ 

	List<TbSlSupplyPayment> queryByUidAndRowCreate(int platformAccountId,String rowCreateTimeStart,String rowCreateTimeEnd, String settlementState,Pageable page);

	List<TbSlSupplyPayment> queryByUidAndRowUpdate(int platformAccountId,String rowUpdateTimeStart,String rowUpdateTimeEnd, String settlementState,Pageable page);

	
	List<TbSlSupplyPayment> queryByUidAndRowCreate(int platformAccountId,String rowCreateTimeStart,String rowCreateTimeEnd, String settlementState);

	List<TbSlSupplyPayment> queryByUidAndRowCreate(int platformAccountId,String rowCreateTimeStart,String rowCreateTimeEnd);
	
	Map<String,TbSlSupplyPayment> queryByUidAndsettlementState(int platformAccountId,String settlementState);
	
	Map<String,TbSlSupplyPayment> queryByUidAndCreateDateMap(int platformAccountId,String createDateStart,String createDateEnd,String settlementState);

	Map<String,TbSlSupplyPayment> queryByUidAndCreateDateMapToday(int platformAccountId,String settlementState);

	

	long querySupplyPaymentMoney(int platformAccountId,String createDateStart,String createDateEnd);

	long querySupplysettlementMoney(int platformAccountId);
	
	long querySupplysettlementMoney(int platformAccountId,String settlementState);
	
	long querySupplysettlementMoneyByCreateDate(int platformAccountId,String createDateStart,String createDateEnd);
	
	long querySupplysettlementMoneyByRowCreateTime(int platformAccountId,String rowCreateTimeStart,String rowCreateTimeEnd);
	
	long querySupplysettlementMoneyByRowCreateTimeToday(int platformAccountId);
	
	
	long querySupplysettlementMoney(int platformAccountId,String createDateStart,String createDateEnd,String rowCreateTimeStart,String rowCreateTimeEnd,String settlementState);
	

	//void init(int platformAccountId,String stime);
	void deleteRepeat(int platformAccountId);
	
	/**
	 * 删除结算单相同单据
	 * @param list
	 */
	
	void removeSettlementCommon(List<TbSlSupplyPayment> list,Map<String,TbSlSupplyPayment> MapDB);
	 
	/**
	 * 删除付款单相同单据
	 * @param list
	 */
	
	void removePaymentCommon(List<TbSlSupplyPayment> list,Map<String,TbSlSupplyPayment> MapDB);
	 
	/**
	 *  库存中存在，抓取数据不存在
	 */
	List<TbSlSupplyPayment> changeToPay(Map<String,TbSlSupplyPayment> MapDB);
	
}
